package com._21cn.cms.yellow.entity;

import com._21cn.framework.utils.StringUtil;

import java.io.Serializable;
import java.util.Date;

public class YellowPagePicture implements Serializable {
    private static final long serialVersionUID = -1L;
    private Integer id;
    private Integer yellowPageId;
    private String picHashcode;
    private String picUrl;
    private Integer orderNum;
    private Integer status;
    private Date createTime = new Date();

    public void setId(Integer id) {
        this.id = id;
    }
    public Integer getId() {
        return this.id;
    }

    public void setYellowPageId(Integer yellowPageId) {
        this.yellowPageId = yellowPageId;
    }
    public Integer getYellowPageId() {
        return this.yellowPageId;
    }

    public void setPicHashcode(String picHashcode) {
        this.picHashcode = picHashcode;
    }
    public String getPicHashcode() {
        return this.picHashcode;
    }

    public void setPicUrl(String picUrl) {
        this.picUrl = picUrl;
    }
    public String getPicUrl() {
        return this.picUrl;
    }
    public String getPicUrl(String code) {
        String picUrl = getPicUrl();
        if (StringUtil.isImageFile(picUrl)) {
            try {
                String[] thumbAry = picUrl.split("/");
                String imgSize = thumbAry[(thumbAry.length - 2)];
                picUrl = picUrl.replaceFirst("/" + imgSize + "/", "/" + code + "/");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }
        return picUrl;
    }

    public void setOrderNum(Integer orderNum) {
        this.orderNum = orderNum;
    }
    public Integer getOrderNum() {
        return this.orderNum;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }
    public Integer getStatus() {
        return this.status;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    public Date getCreateTime() {
        return this.createTime;
    }
}